package com.publiccms.entities.sys;

// Generated 2016-2-24 12:08:34 by Hibernate Tools 4.3.1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

import com.sanluan.common.source.entity.MyColumn;

/**
 * SysUserToken generated by hbm2java
 */
@Entity
@Table(name = "sys_user_token", uniqueConstraints = @UniqueConstraint(columnNames = "auth_token"))
public class SysUserToken implements java.io.Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    @MyColumn(title = "ID")
    private Integer id;
    @MyColumn(title = "用户", condition = true)
    private int userId;
    @MyColumn(title = "授权码")
    private String authToken;
    @MyColumn(title = "授权渠道", condition = true)
    private String channel;
    @MyColumn(title = "授权日期", order = true)
    private Date createDate;
    @MyColumn(title = "登录IP")
    private String loginIp;

    public SysUserToken() {
    }

    public SysUserToken(int userId, String authToken, String channel, Date createDate, String loginIp) {
        this.userId = userId;
        this.authToken = authToken;
        this.channel = channel;
        this.createDate = createDate;
        this.loginIp = loginIp;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return this.userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Column(name = "auth_token", unique = true, nullable = false, length = 40)
    public String getAuthToken() {
        return this.authToken;
    }

    public void setAuthToken(String authToken) {
        this.authToken = authToken;
    }

    @Column(name = "channel", nullable = false, length = 50)
    public String getChannel() {
        return this.channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_date", nullable = false, length = 19)
    public Date getCreateDate() {
        return this.createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Column(name = "login_ip", nullable = false, length = 20)
    public String getLoginIp() {
        return this.loginIp;
    }

    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp;
    }

}
